package com.shimmer;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;

/**
 * @Package com.shimmer
 * @Author shimmer
 * @Date 2020/8/15 18:34
 * @TODO
 */
public class HelloServlet extends HttpServlet {
    // 自启动方法
    @Override
    public void init() throws ServletException {
        System.out.println("自启动HelloServlet");
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().println("Hello,Servlet!");
        resp.getWriter().println(new Date().toLocaleString());
    }
}
